import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
  DownloadTemple = '/static/file',
  DownloadErrorData = '/file/import-error-data',
  DownloadFile = '/file',
}

// 下载模版
export async function downloadTemple(fileName: string, mode: ErrorMessageMode = 'message') {
  return defHttp.download(
    {
      url: Api.DownloadTemple + `/${fileName}`,
      method: 'GET',
      responseType: 'blob',
    },
    {
      errorMessageMode: mode,
    },
  );
}
// 下载文件
export async function downloadFiLe(fileId: string, mode: ErrorMessageMode = 'message') {
  return defHttp.download(
    {
      url: Api.DownloadFile + `/${fileId}`,
      method: 'GET',
      responseType: 'blob',
    },
    {
      errorMessageMode: mode,
    },
  );
}
// 下载导入的错误数据
export async function downloadErrorData(fileId: string, mode: ErrorMessageMode = 'message') {
  return defHttp.download(
    {
      url: Api.DownloadErrorData + `/${fileId}`,
      method: 'GET',
      responseType: 'blob',
    },
    {
      errorMessageMode: mode,
    },
  );
}
